package com.lsh.oms.core.service.business.impl;

import com.lsh.base.common.model.CommonResult;
import com.lsh.oms.api.model.status.CancelOrderDto;
import com.lsh.oms.core.enums.OrderOperateType;
import com.lsh.oms.core.enums.OrderStatus;
import com.lsh.oms.core.model.order.OrderHead;
import org.springframework.stereotype.Service;

/**
 *
 * @author peter
 * @date 19/3/23
 */
@Service("cancelOrder4misCodeServiceImpl")
public class CancelOrder4misCodeServiceImpl extends AbstractCancelOrderService {

    @Override
    protected boolean checkParams(CancelOrderDto cancelOrderDto) {
        boolean flag = false;
        Long orderCode = cancelOrderDto.getOrderCode();
        if (super.checkOrderCode(orderCode)) {
                flag = true;
        }

        return flag;
    }

    @Override
    protected boolean checkStatus(int status, int region) {
        boolean flag = false;
        if (status < OrderStatus.ORDER_COMMITED_OFC.getIndex()) {
            flag = true;
        }
        return flag;
    }

    @Override
    protected CommonResult<Boolean> cancel(OrderHead orderHead, String logSign) {
        return CommonResult.success(true);
    }

    @Override
    protected OrderOperateType getOperateType() {
        return OrderOperateType.ORDER_CANCEL_BY_CUSTOM_SERVICE;
    }

    @Override
    protected OrderStatus getOrderStatus() {
        return OrderStatus.ORDER_CANCEL_CUSTOMERSERVICE;
    }

    @Override
    protected boolean isForceCancel(OrderHead orderHead, String logSign) {
        return false;
    }
}
